<!DOCTYPE HTML>
<html lang="zh-hans" >
    <!-- Start book Linux -->
<!-- Start book Linux -->
    <head>
        <!-- head:start -->
<!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>分支操作 | Linux</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="chris Jiang">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-prism/prism.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../14/section04.html" />
    
    
    <link rel="prev" href="../14/section02.html" />
    

        <!-- head:end -->
<!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
<!-- body:start -->
        
    <div class="book"
        data-level="14.3"
        data-chapter-title="分支操作"
        data-filepath="14/section03.md"
        data-basepath=".."
        data-revision="Mon Sep 30 2019 00:13:13 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        学习目标
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="chapter01.html">
            
                
                    <a href="../chapter01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Linux入门
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="01/section01.html">
            
                
                    <a href="../01/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        操作系统介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="01/section02.html">
            
                
                    <a href="../01/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        Linux系统介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="01/section03.html">
            
                
                    <a href="../01/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        使用虚拟机安装Ubuntu
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="01/section04.html">
            
                
                    <a href="../01/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        使用U盘安装双系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="01/section05.html">
            
                
                    <a href="../01/section05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        配置Linux系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="01/section06.html">
            
                
                    <a href="../01/section06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        Linux启动流程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="01/section07.html">
            
                
                    <a href="../01/section07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        远程连接Linux
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="chapter02.html">
            
                
                    <a href="../chapter02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        软件安装相关指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3" data-path="chapter03.html">
            
                
                    <a href="../chapter03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        文件系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4" data-path="chapter04.html">
            
                
                    <a href="../chapter04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        vim编辑器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="chapter05.html">
            
                
                    <a href="../chapter05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        目录操作的常见指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="chapter06.html">
            
                
                    <a href="../chapter06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        python、pip和ipython的安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="chapter07.html">
            
                
                    <a href="../chapter07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        虚拟环境管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="chapter08.html">
            
                
                    <a href="../chapter08.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        用户管理相关指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9" data-path="chapter09.html">
            
                
                    <a href="../chapter09.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        权限管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10" data-path="chapter10.html">
            
                
                    <a href="../chapter10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        压缩解压命令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11" data-path="chapter11.html">
            
                
                    <a href="../chapter11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        服务监听
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12" data-path="chapter12.html">
            
                
                    <a href="../chapter12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                        管道和重定向
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="13" data-path="chapter13.html">
            
                
                    <a href="../chapter13.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>13.</b>
                        
                        Nginx的安装和配置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14" data-path="chapter14.html">
            
                
                    <a href="../chapter14.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.</b>
                        
                        Git的使用
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="14.1" data-path="14/section01.html">
            
                
                    <a href="../14/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.1.</b>
                        
                        git本地和远端管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14.2" data-path="14/section02.html">
            
                
                    <a href="../14/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.2.</b>
                        
                        冲突的介绍
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="14.3" data-path="14/section03.html">
            
                
                    <a href="../14/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.3.</b>
                        
                        分支操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14.4" data-path="14/section04.html">
            
                
                    <a href="../14/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.4.</b>
                        
                        远端服务器的SSH连接
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="15" data-path="chapter15.html">
            
                
                    <a href="../chapter15.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>15.</b>
                        
                        shell编程
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本书使用 GitBook 发布
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >Linux</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="git&#x5206;&#x652F;">Git&#x5206;&#x652F;</h1>
<ul>
<li><p>&#x5206;&#x652F;&#x7684;&#x4F5C;&#x7528;</p>
<blockquote>
<p>&#x5047;&#x8BBE;&#x4F60;&#x51C6;&#x5907;&#x5F00;&#x53D1;&#x4E00;&#x4E2A;&#x65B0;&#x529F;&#x80FD;&#xFF0C;&#x4F46;&#x662F;&#x9700;&#x8981;&#x4E24;&#x5468;&#x624D;&#x80FD;&#x5B8C;&#x6210;&#xFF0C;&#x7B2C;&#x4E00;&#x5468;&#x4F60;&#x5199;&#x4E86;50%&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x5982;&#x679C;&#x7ACB;&#x523B;&#x63D0;&#x4EA4;&#xFF0C;&#x7531;&#x4E8E;&#x4EE3;&#x7801;&#x8FD8;&#x6CA1;&#x5199;&#x5B8C;&#xFF0C;&#x4E0D;&#x5B8C;&#x6574;&#x7684;&#x4EE3;&#x7801;&#x5E93;&#x4F1A;&#x5BFC;&#x81F4;&#x522B;&#x4EBA;&#x4E0D;&#x80FD;&#x5E72;&#x6D3B;&#x4E86;&#x3002;&#x5982;&#x679C;&#x7B49;&#x4EE3;&#x7801;&#x5168;&#x90E8;&#x5199;&#x5B8C;&#x518D;&#x4E00;&#x6B21;&#x63D0;&#x4EA4;&#xFF0C;&#x53C8;&#x5B58;&#x5728;&#x4E22;&#x5931;&#x6BCF;&#x5929;&#x8FDB;&#x5EA6;&#x7684;&#x5DE8;&#x5927;&#x98CE;&#x9669;&#x3002; &#x73B0;&#x5728;&#x6709;&#x4E86;&#x5206;&#x652F;&#xFF0C;&#x5C31;&#x4E0D;&#x7528;&#x6015;&#x4E86;&#x3002;&#x4F60;&#x521B;&#x5EFA;&#x4E86;&#x4E00;&#x4E2A;&#x5C5E;&#x4E8E;&#x4F60;&#x81EA;&#x5DF1;&#x7684;&#x5206;&#x652F;&#xFF0C;&#x522B;&#x4EBA;&#x770B;&#x4E0D;&#x5230;&#xFF0C;&#x8FD8;&#x7EE7;&#x7EED;&#x5728;&#x539F;&#x6765;&#x7684;&#x5206;&#x652F;&#x4E0A;&#x6B63;&#x5E38;&#x5DE5;&#x4F5C;&#xFF0C;&#x800C;&#x4F60;&#x5728;&#x81EA;&#x5DF1;&#x7684;&#x5206;&#x652F;&#x4E0A;&#x5E72;&#x6D3B;&#xFF0C;&#x60F3;&#x63D0;&#x4EA4;&#x5C31;&#x63D0;&#x4EA4;&#xFF0C;&#x76F4;&#x5230;&#x5F00;&#x53D1;&#x5B8C;&#x6BD5;&#x540E;&#xFF0C;&#x518D;&#x4E00;&#x6B21;&#x6027;&#x5408;&#x5E76;&#x5230;&#x539F;&#x6765;&#x7684;&#x5206;&#x652F;&#x4E0A;&#xFF0C;&#x8FD9;&#x6837;&#xFF0C;&#x65E2;&#x5B89;&#x5168;&#xFF0C;&#x53C8;&#x4E0D;&#x5F71;&#x54CD;&#x522B;&#x4EBA;&#x5DE5;&#x4F5C;&#x3002;</p>
</blockquote>
</li>
<li><p>&#x5206;&#x652F;&#x7684;&#x672C;&#x8D28;</p>
<blockquote>
<p>Git&#x5206;&#x652F;&#x7684;&#x5176;&#x5B9E;&#x672C;&#x8D28;&#x4EC5;&#x4EC5;&#x662F;&#x6307;&#x5411;&#x63D0;&#x4EA4;&#x5BF9;&#x8C61;&#x7684;&#x53EF;&#x53D8;&#x6307;&#x9488;&#x3002; Git &#x7684;&#x9ED8;&#x8BA4;&#x5206;&#x652F;&#x540D;&#x5B57;&#x662F; <code>master</code>&#x3002; &#x5728;&#x591A;&#x6B21;&#x63D0;&#x4EA4;&#x64CD;&#x4F5C;&#x4E4B;&#x540E;&#xFF0C;&#x4F60;&#x5176;&#x5B9E;&#x5DF2;&#x7ECF;&#x6709;&#x4E00;&#x4E2A;&#x6307;&#x5411;&#x6700;&#x540E;&#x90A3;&#x4E2A;&#x63D0;&#x4EA4;&#x5BF9;&#x8C61;&#x7684; <code>master</code> &#x5206;&#x652F;&#x3002; &#x5B83;&#x4F1A;&#x5728;&#x6BCF;&#x6B21;&#x7684;&#x63D0;&#x4EA4;&#x64CD;&#x4F5C;&#x4E2D;&#x81EA;&#x52A8;&#x5411;&#x524D;&#x79FB;&#x52A8;&#x3002;</p>
<p><code>.git/HEAD</code>&#x8FD9;&#x4E2A;&#x7279;&#x6B8A;&#x6307;&#x9488;&#x6765;&#x8868;&#x793A;&#x5F53;&#x524D;&#x5230;&#x5E95;&#x5728;&#x54EA;&#x4E2A;&#x5206;&#x652F;&#x3002;</p>
</blockquote>
</li>
<li><p>&#x521B;&#x5EFA;&#x672C;&#x5730;&#x5206;&#x652F;</p>
<p><img src="../imgs/&#x5206;&#x652F;&#x64CD;&#x4F5C;.png" alt=""></p>
</li>
<li><p>&#x5206;&#x652F;&#x5408;&#x5E76;</p>
<p>  <img src="../imgs/&#x5206;&#x652F;&#x5408;&#x5E76;.png" alt=""></p>
</li>
<li><p>&#x67E5;&#x770B;&#x672C;&#x5730;&#x5206;&#x652F;&#x548C;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x7684;&#x6620;&#x5C04;&#x5173;&#x7CFB;&#x3002;</p>
<pre><code class="lang-shell">git branch -vv
</code></pre>
</li>
<li><p>&#x521B;&#x5EFA;&#x8FDC;&#x7A0B;&#x5206;&#x652F;
&#x65B9;&#x5F0F;&#x4E00;:
 &#x76F4;&#x63A5;&#x5C06;&#x672C;&#x5730;develop&#x5206;&#x652F;&#x7684;&#x5185;&#x5BB9;&#x63A8;&#x9001;&#x5230;&#x8FDC;&#x7AEF;&#x7684;develop,&#x5E76;&#x4E14;&#x5C06;&#x672C;&#x5730;&#x7684;develop&#x5206;&#x652F;&#x548C;&#x8FDC;&#x7AEF;&#x5EFA;&#x7ACB;&#x6620;&#x5C04;&#x5173;&#x7CFB;<code>git push --set-upstream origin develop</code>
&#x65B9;&#x5F0F;&#x4E8C;:</p>
<pre><code class="lang-shell">git push origin test:test  # &#x5C06;&#x672C;&#x5730;&#x7684;test&#x5206;&#x652F;&#x63A8;&#x9001;&#x5230;&#x8FDC;&#x7AEF;&#x5206;&#x652F; test
git branch --set-upstream-to origin/test # &#x5C06;&#x672C;&#x5730;&#x7684;test&#x5206;&#x652F;&#x4E0E;&#x4E0E;&#x8FDC;&#x7AEF;&#x7684;test&#x5206;&#x652F;&#x5173;&#x8054;
</code></pre>
</li>
<li><p>&#x5C06;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x62C9;&#x53D6;&#x5230;&#x672C;&#x5730;</p>
<pre><code class="lang-shell">git pull origin develop:develop  # &#x5C06;&#x8FDC;&#x7AEF;&#x4E0A;&#x7684;develop&#x5206;&#x652F;&#x62C9;&#x53D6;&#x5230;&#x672C;&#x5730;&#x7684;develop&#x5206;&#x652F;
</code></pre>
</li>
<li><p>&#x5220;&#x9664;&#x8FDC;&#x7AEF;&#x5206;&#x652F;</p>
<pre><code class="lang-shell">git push origin --delete develop  # &#x5C06;&#x8FDC;&#x7AEF;&#x5206;&#x652F;develop&#x5220;&#x9664;
</code></pre>
</li>
</ul>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../14/section02.html" class="navigation navigation-prev " aria-label="Previous page: 冲突的介绍"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../14/section04.html" class="navigation navigation-next " aria-label="Next page: 远端服务器的SSH连接"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-copy-code-button/toggle.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"prism":{},"splitter":{},"copy-code-button":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
<!-- body:end -->
    </body>
    <!-- End of book Linux -->
<!-- End of book Linux -->
</html>
